import 'package:flutter/material.dart';

class MarkHeader1Widget extends StatefulWidget {

  final String text;
  final FocusNode focusNode;

  const MarkHeader1Widget({
    key,
    this.text = "",
    required this.focusNode
  }) : super(key: key);

  @override
  State<StatefulWidget> createState() {
    return MarkHeader1State();
  }
}

class MarkHeader1State extends State<MarkHeader1Widget> {

  @override
  Widget build(BuildContext context) {
    return TextField(
      controller: TextEditingController(text: widget.text),
      focusNode: widget.focusNode,
      maxLines: 1,
      cursorColor: Colors.black,
      keyboardType: TextInputType.multiline,
      style: const TextStyle(
          overflow: TextOverflow.ellipsis,
          fontSize: 30,
          fontWeight: FontWeight.bold,
          height: 1                        // 处理中英文选中时高度不同问题
      ),
      decoration: const InputDecoration(
        border: InputBorder.none,
      ),
      onSubmitted: (text) {
        print("newline: $text");
      }, 
    );
  }
}
